import { TableColumnObject } from 'amis/lib/renderers/Table'
import amisUtils from '@/components/amis/amisUtils'
import UpmsMenuShowStatusEnum from '@/core/upms/enums/UpmsMenuShowStatusEnum'

class UpmsMenuShowStatusColumnUtils {
	getSchema = (parmas?: TableColumnObject): TableColumnObject => {
		const name = parmas?.name ? parmas.name : 'showStatus'
		const label = '显示状态'
		const elseMap = `\${${name}}`
		const mergeSchema = Object.assign(
			{
				name: name,
				label: label,
				type: 'mapping',
				map: {
					...amisUtils.getSelectOptionsFromBaseEnum(UpmsMenuShowStatusEnum),
					'*': elseMap,
				},
			} as TableColumnObject,
			parmas,
		)

		const schema = mergeSchema
		return schema as TableColumnObject
	}
}

export default new UpmsMenuShowStatusColumnUtils()
